package com.talent.controller;

import com.talent.common.Result;
import com.talent.pojo.entity.Category;
import com.talent.pojo.vo.DashboardOverviewVO;
import com.talent.service.DashboardService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据看板控制器
 */
@RestController
@RequestMapping("/api/dashboard")
@Slf4j
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    /**
     * 获取概览数据
     */
    @GetMapping("/overview")
    public Result<DashboardOverviewVO> getOverview() {
        log.info("获取概览数据");
        DashboardOverviewVO overview = dashboardService.getOverview();
        return Result.success(overview);
    }

    /**
     * 获取公共资源分类数据
     */
    @GetMapping("/public-resources")
    public Result<List<Category>> getPublicResourcesData() {
        log.info("获取公共资源分类数据");
        List<Category> data = dashboardService.getPublicResourcesData();
        return Result.success(data);
    }

    /**
     * 获取服务站点统计数据
     */
    @GetMapping("/talent-stations")
    public Result<List<Category>> getTalentStations() {
        log.info("获取服务站点统计数据");
        List<Category> data = dashboardService.getTalentStations();
        return Result.success(data);
    }
}
